/** 存放所有花卉百科模块相关接口 */ 
import myaxios from "../MyAxios";

import URLENV from '@/http/BaseUrl'
const HYRJURL = URLENV.HYRJURL

const EncyclopediasApi = {
  /**
   * 查询花卉百科分类
   */
  queryTypes(){
    let url = HYRJURL + '/flowerEncyclopedia/types'
    return myaxios.get(url)
  },
  
  /**
   * 新增百科详情
   * @param {Object} params 
   * 参数列表： { name: 花卉名称，cover: 花卉图片，type_id: 花卉类型编号，detail: 百科简介详情}
   */
  add(params){
    let url = HYRJURL + "/flowerEncyclopedia/add"
    return myaxios.post(url, params)
  },

  /**
   * 删除花卉百科详情接口
   * @param {object} params 
   * 参数列表：{id:花卉id}
   */
  delete(params){
    let url = HYRJURL + '/flowerEncyclopedia/delete'
    return myaxios.get(url,params)
  },

  /**
   *  修改花卉百科详情接口
   * @param {object} params 
   * 参数列表：{id:百科详情id，name: 花卉名称，cover: 花卉图片，type_id: 花卉类型编号，detail: 百科简介详情}
   */
  update(params){
    let url = HYRJURL + '/flowerEncyclopedia/update'
    return myaxios.post(url,params)
  },

  /**
   * 通过关键字，模糊查询花卉详情列表
   * @param {Object} params 参数列表： {name:'关键字'}
   */
  queryInfoByNameLike(params){
    let url = HYRJURL + "/flowerEncyclopedia/flower-info/name"
    return myaxios.get(url, params)
  },

  /**
   * 通过id查询花卉详情接口
   * @param {object} params 
   * 参数列表：{id:花卉ID}
   */
  queryInfoById(params){
    let url = HYRJURL + '/flowerEncyclopedia/flower-info/id'
    return myaxios.get(url,params)
  },

  /**
   * 通过花卉百科类型查询百科详情,带分页
   * @param {object} params 
   * 参数列表：{page: 1，pagesize: 5，type_id：10 }
   */
  queryInfoByTypes(params){
    let url = HYRJURL + '/flowerEncyclopedia/flower-infos/types'
    return myaxios.get(url,params)
  }

}
export default EncyclopediasApi;